package com.cwits.wifi.ui.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.cwits.wifi.R;


/**
 * Created by ZhangHua on 16-03-01.
 */
public class TwoDialog extends Dialog {

    private TextView mTvTitle;
    private TextView mTvType;
    private RelativeLayout mRlCancle, mRlOk;

    public TwoDialog(Context context, String title, String type, View.OnClickListener itemsOnClick) {
        super(context, R.style.MyDialog);
        setContentView(R.layout.dialog_btn2);

        this.setCanceledOnTouchOutside(false);
        this.setCancelable(false);

        Window window = getWindow();
        WindowManager.LayoutParams params = window.getAttributes();
        params.gravity = Gravity.CENTER;
        window.setAttributes(params);

        mTvTitle = (TextView) findViewById(R.id.editText1);
        mTvType = (TextView) findViewById(R.id.dialog_btn2_tv_info);
        mRlCancle = (RelativeLayout) findViewById(R.id.dialog_btn2_rl_canale);
        mRlOk = (RelativeLayout) findViewById(R.id.dialog_btn2_rl_ok);

        mTvTitle.setText(title);
        mTvType.setText(type);
        mRlOk.setOnClickListener(itemsOnClick);
        mRlCancle.setOnClickListener(itemsOnClick);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


    }

    @Override
    public void show() {
        if (this.isShowing())
            return;
        super.show();
    }
}
